projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0957ba5
)
bitmask: Optimize no-op resizes
author
Matthias Clasen
<mclasen@redhat.com>
Thu, 10 Sep 2015 22:48:29 +0000
(18:48 -0400)
committer
Matthias Clasen
<mclasen@redhat.com>
Sat, 12 Sep 2015 15:24:37 +0000
(11:24 -0400)
Statistics for the gtk3-demo listbox example show that the
vast majority of calls to _gtk_allocated_bitmask_resize go
from a size of 2 to 2. Don't needlessly call realloc() in
this case.
gtk/gtkallocatedbitmask.c
patch
|
blob
|
history
diff --git
a/gtk/gtkallocatedbitmask.c
b/gtk/gtkallocatedbitmask.c
index 567b86cb91b65551a5e2b7a93d14265475c658a0..0950d4362dec64489cf406a2596b113a3db1e723 100644
(file)
--- a/
gtk/gtkallocatedbitmask.c
+++ b/
gtk/gtkallocatedbitmask.c
@@
-52,6
+52,9
@@
gtk_allocated_bitmask_resize (GtkBitmask *mask,
{
gsize i;
+ if (size == mask->len)
+ return mask;
+
mask = g_realloc (mask, sizeof (GtkBitmask) + sizeof(VALUE_TYPE) * (size - 1));
for (i = mask->len; i < size; i++)